package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.zhadoop.stream.cql.CQLUtils;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.InnerClassNameContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.UserDefinedClassNameContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ClassNameContext;

public class ClassNameVisitor extends AbsCQLParserBaseVisitor<ClassNameContext>{

	private ClassNameContext context = null;
	
	public ClassNameVisitor() {
		context = new ClassNameContext();
	}
	
	@Override
	protected ClassNameContext defaultResult() {
		return context;
	}
	
	@Override
	public ClassNameContext visitInnerClassName(InnerClassNameContext ctx) {
		context.setClassName(ctx.getText());
		context.setInnerClass(true);
		return context;
	}
	
	@Override
	public ClassNameContext visitUserDefinedClassName(UserDefinedClassNameContext ctx) {
		context.setClassName(CQLUtils.cqlStringLiteralTrim(ctx.getText()));
		context.setInnerClass(false);
		return super.visitUserDefinedClassName(ctx);
	}

}
